<template>
  <div class="photo-page">
    <div class="header">
      <button class="cancel-button" @click="goBack">取消</button>
      <button class="publish-button" @click="publish">发表</button>
    </div>
    <textarea placeholder="这一刻的想法..."></textarea>
    <div class="image-container">
      <div class="image-item" v-for="(image, index) in imageList" :key="index">
        <image :src="image" mode="aspectFill"></image>
      </div>
      <div class="add-image-item" @click="addImage">
        <view class="plus-icon">+</view>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      imageList: [],
    };
  },
  methods: {
    addImage() {
      const tempImagePath = 'file:///D:/软件工程导论/青年/static/章若楠.png'; 
      this.imageList.push(tempImagePath);
    },
    publish() {
      console.log('发表图片内容:', this.imageList);
    },
    goBack() {
      uni.navigateBack();
    }
  }
};
</script>

<style scoped>
.photo-page {
  padding: 20px;
   background-image: radial-gradient(circle at center, #ffffff, #b3e5fc, #f9fbe7);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  margin-bottom: 20px;
}

button {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.cancel-button {
  background-color: #81d4fa;
  color: #333;
}

.publish-button {
  background-color: #007aff;
  color: white;
}

.text-container {
  width: 100%;
  margin-bottom: 20px;
}

textarea {
  width: 80%;
  height: 80px;
  padding: 10px;
  border: 1px solid #81d4fa;
  border-radius: 10px;
  background-color: #f8f9fa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin: 0 auto;
}

.image-container {
  display: flex;
  flex-wrap: wrap;
}

.image-item {
  width: 80px;
  height: 80px;
  margin-right: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.add-image-item {
  width: 80px;
  height: 80px;
  margin-right: 10px;
  margin-bottom: 10px;
  background-color: #e6f2ff;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 5px;
  cursor: pointer;
}

.plus-icon {
  font-size: 24px;
  color: #007aff;
}
</style>

